package com.itheima;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RequestController {
    @RequestMapping("/request")
    public String request(HttpServletRequest request){

        String method=request.getMethod();
        System.out.println("请求方式为:"+method);

        String url=request.getRequestURI().toString();
        System.out.println("请求路径为:"+url);

        String uri=request.getRequestURI().toString();
        System.out.println("请求URI为:"+uri);

        String protocol=request.getProtocol();
        System.out.println("协议为:"+protocol);

        String name=request.getParameter("name");
        String age=request.getParameter("age");
        System.out.println("name:"+name+",age:"+age);


        String accept=request.getHeader("Accept");
        System.out.println("Accept:"+accept);


        return "OK";
    }

}
